<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>供需对接服务系统--项目列表</title>
    <!--公用样式-->
    <link rel="stylesheet" type="text/css" href="${re.contextPath}/plugin/common/css/comment.css"/>
    <link rel="stylesheet" type="text/css" href="${re.contextPath}/plugin/supplier/common/css/style.css"/>
    <!--Layui-->
    <link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css" media="all"/>
    <!--extended-->
    <link rel="stylesheet" type="text/css" href="${re.contextPath}/plugin/common/css/extended.css"/>
    <!--公用样式JS-->
    <script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="${re.contextPath}/plugin/common/js/comment.js"></script>
    <script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="${re.contextPath}/pageoffice.js" id="po_js_main"></script>
</head>
<style>
    .Right {
        width: 100%;
        overflow-y: scroll;
    }
	.widthle{
		width: 50%;
	}
	.widinput{
		width: 50%!important;
	}

</style>

<body>
<!--头部-->

<!--容器-->
<div class="container clearfix">
    <!--右侧内容-->
    <div class="Right fr mt10">
        <div class="screening screeningOne whitebg clearfix">
            <ul class="clearfix fl" style="width: 100%;">
                <li style="width: 20%;">
                    <label class="fl">所属分部:</label>
                    <input type="text"  class="widinput" style="border: 1px solid #DDDDDD;width: 50%" name="ssfb" id="ssfb"
                           autocomplete="off">
                </li>
                <li style="width: 20%;">
                    <label class="fl">项目名称:</label>
                    <input type="text"   class="widinput" style=";border: 1px solid #DDDDDD" name="xmmc" id="xmmc"
                           autocomplete="off">
                </li>
                <li style="width: 20%;">
                    <label class="fl">销售经理:</label>
                    <input type="text"  class="widinput" style="border: 1px solid #DDDDDD;width: 50%" name="xsry" id="xsry"
                           autocomplete="off">
                </li>
                <li style="width: 20%;">
                    <label class="fl">合同名称:</label>
                    <input type="text"  class="widinput" style="border: 1px solid #DDDDDD;width: 50%" name="htmc" id="htmc"
                           autocomplete="off">
                </li>
                <li style="width: 20%;">
                    <label class="fl">合同编号:</label>
                    <input type="text"  class="widinput" style="border: 1px solid #DDDDDD" name="htbh" id="htbh"
                           autocomplete="off" placeholder="全部">
                </li>
<#--                <li style="width: 20%;">
					<label class="fl">合同类型:</label>
                    <input type="text"  class="widinput" style="border: 1px solid #DDDDDD" name="htlx" id="htlx"
                        autocomplete="off" placeholder="全部">
                </li>-->
          <#--      <li style="width: 36%;">
                    <label class="fl" style="width: 17%;" >签订时间:</label>
                    <input type="text"   style="border: 1px solid #DDDDDD;width: 30%;" name="startDate" id="startDate"
                           autocomplete="off" placeholder="开始时间">
                    至
                    <input type="text"  style="border: 1px solid #DDDDDD;width: 30%;" name="endDate" id="endDate"
                           autocomplete="off" placeholder="结束时间">
                </li>-->
<#--                <li style="width: 20%;">
                    <label class="fl">是否有首付款:</label>
                    <select name="sfysfk" id="sfysfk"  class="widinput">
                        <option value="">全部</option>
                        <option value="是">是</option>
                        <option value="否">否</option>
                    </select>
                </li>-->
<#--                <li style="width: 36%;">
                    <label class="fl" style="width: 25%;" >合同金额(元):</label>
                    <input type="text"   style="border: 1px solid #DDDDDD;width: 30%;" name="htmin" id="htmin"
                           autocomplete="off" placeholder="最小值">
                    <input type="text"  style="border: 1px solid #DDDDDD;width: 30%;" name="htmax" id="htmax"
                           autocomplete="off" placeholder="最大值">
                </li>-->
 <#--               <li style="width: 36%;">
                    <label class="fl" style="width: 26%;" >项目投资额(元):</label>
                    <input type="text"   style="border: 1px solid #DDDDDD;width: 30%;" name="xmmin" id="xmmin"
                           autocomplete="off" placeholder="最小值">
                    <input type="text"  style="border: 1px solid #DDDDDD;width: 30%;" name="xmmax" id="xmmax"
                           autocomplete="off" placeholder="最大值">
                </li>-->
            </ul>

            <ul class="clearfix fl mt10" style="width: 100%;">
                <li style="width: 20%;">
                    <label class="fl ">客户名称:</label>
                    <input type="text"   class="widinput" style=";border: 1px solid #DDDDDD" name="khmc" id="khmc"
                           autocomplete="off">
                </li>

 <#--               <li style="width: 36%;">
                    <label class="fl">工期:</label>
                    <input type="text"   style="border: 1px solid #DDDDDD;width: 30%;" name="gqmin" id="gqmin"
                           autocomplete="off" placeholder="最小值">
                    <input type="text"  style="border: 1px solid #DDDDDD;width: 30%;" name="gqmax" id="gqmax"
                           autocomplete="off" placeholder="最大值">
                </li>-->
                <li style="width: 20%;">
					<label class="fl" >行业:</label>
                    <input type="text"   class="widinput" style=";border: 1px solid #DDDDDD" name="hy" id="hy"
                           autocomplete="off">
                </li>
                <li style="width: 20%">
                    <label class="fl">省份:</label>
                    <select name="sheng" class="ml8 widinput" id="sheng"  onchange="provinceChange(this)"  class="widinput"
                            lay-verify="required" lay-ignore>
                        <option value="">全部</option>
                        <#list provincelist as vo>
                            <option value="${vo.code}">${vo.name}</option>
                        </#list>
                    </select>
                </li>
                <li style="width: 20%">
                    <label class="fl">城市:</label>
                    <select name="shi" id="shi" class="ml8 widinput" lay-filter="city" lay-verify="required"
                            style="margin-left: 0px" lay-ignore   onchange="cityChange(this)">
                        <option value="">全部</option>
                    </select>
                </li>
            <#--    <li style="width: 20%;">
					<label class="fl">申请人:</label>
                    <input type="text"   class="widinput" style=";border: 1px solid #DDDDDD" name="sqr" id="sqr"
                           autocomplete="off">
                </li>-->
                <li style="width: 20%;">
                     <label class="fl">项目类型:</label>
                     <input type="text"  class="widinput" style="border: 1px solid #DDDDDD" name="htlx" id="htlx"
                         autocomplete="off" placeholder="全部">
                 </li>


            </ul>
            <ul class="clearfix fl mt10" style="width: 100%;">
                <li style="width: 20%;text-align: center;float: right;">
                    <button type="button" class="layui-btn layui-btn-normal" style="width:65px; height:40px;" onclick="query()">筛选</button>
                    <button type="button" class="layui-btn layui-btn-normal" onclick="resetQuery()"
                            style="width:65px; height:40px;background-color: #FF5722;">重置
                    </button>
                </li>

            </ul>
        </div>

        <div class="project whitebg">
            <div style=" height: 50px;margin-top: 10px;">
                <@shiro.hasPermission name="search:export">
                    <input class="layui-btn layui-btn-normal layui-btn-sm fr ml10" type="button" value="导出Excel" onclick="exportTable()">
                </@shiro.hasPermission>
                <@shiro.hasPermission name="search:view">
                    <input class="layui-btn layui-btn-danger layui-btn-sm fr" type="button" value="预览Excel" onclick="viewTable()">
                </@shiro.hasPermission>
            </div>
            <table id="tableList" class="layui-hide" lay-filter="tableList"></table>
        </div>
    </div>
</div>
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js"></script>
<script type="text/javascript" charset="utf-8" src="${re.contextPath}/plugin/common/js/tabs.js"></script>
<script type="text/javascript">
    var layer;
    var form = layui.form;
    var table = null;
    var tableIns = null;
    //注意进度条依赖 element 模块，否则无法进行正常渲染和功能性操作
    var element = "";
    layui.use('element', function () {
        element = layui.element;


    });
    layui.use('laydate', function () {
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#beginDate' //指定元素
        });
        laydate.render({
            elem: '#endDate' //指定元素
        });
    });

    function queryData(){
        // 项目归属
        var htmc = $('#htmc').val();
        var htbh = $('#htbh').val();
        var htlx = $('#htlx').val();
        var startDate = $('#startDate').val();
        var endDate = $('#endDate').val();
        var sfysfk = $('#sfysfk').val();
        var htmin = $('#htmin').val();
        var htmax = $('#htmax').val();
        var xmmin = $('#xmmin').val();
        var xmmax = $('#xmmax').val();
        var gqmin = $('#gqmin').val();
        var gqmax = $('#gqmax').val();
        var hy = $('#hy').val();
        var sqr = $('#sqr').val();
        var xmmc = $('#xmmc').val();
        var ssfb = $('#ssfb').val();
        var xsry = $('#xsry').val();
        var sheng = $('#sheng').val();
        var shi = $('#shi').val();
        var khmc = $('#khmc').val();

        var jsondata = {
            htmc :	htmc ,
            htbh :	htbh ,
            htlx :	htlx ,
            startDate :	startDate ,
            endDate :	endDate ,
            sfysfk :	sfysfk ,
            htmin :	htmin ,
            htmax :	htmax ,
            xmmin :	xmmin ,
            xmmax :	xmmax ,
            gqmin :	gqmin ,
            gqmax :	gqmax ,
            hy :	hy ,
            sqr :	sqr ,
            xmmc :	xmmc ,
            ssfb :	ssfb ,
            xsry :	xsry ,
            sheng :	sheng ,
            shi :	shi ,
            khmc :	khmc
        };
        return jsondata;
    }

    function query() {
        var jsondata = queryData();
       table.reload('tableList', {where: jsondata});
    }

    layui.use('laydate', function () {
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#startDate' //指定元素
        });
        laydate.render({
            elem: '#endDate' //指定元素
        });
    });

    layui.use('table', function () {
        table = layui.table;
        element = element;
        //方法级渲染
        tableIns = table.render({
            id: 'tableList',
            elem: '#tableList',
            url: '/search/buProjectInfo/showOaDataList',
            height: "auto",
            page: true,
            cols: [[
                {
                    title: '序号', width: '10%', templet: function (res) {
                        return res.LAY_INDEX;
                    }
                },
                {field: 'ssfb',align: 'center',title: '	所属分部',width: 200},
                {field: 'xmmc',align: 'center',title: '	项目名称',width: 200},
                {field: 'ssxmys', align: 'center', title: '项目预算', rowspan: 2, width: 200},
                {field: 'xsry', align: 'center', title: '销售经理', rowspan: 2, width: 200},
                {field: 'sszbsj', align: 'center', title: '中标日期', rowspan: 2, width: 200},
                {field: 'htmc', align: 'center', title: '合同名称', rowspan: 2, width: 200},
                {field: 'htbh', align: 'center', title: '合同编号', rowspan: 2, width: 200},
                {field: 'ssxmtze', align: 'center', title: '投资金额', rowspan: 2, width: 200},
                {field: 'sshtje', align: 'center', title: '合同金额', rowspan: 2, width: 200},
                {field: 'fl',align: 'center',title: '费率(%)',width: 200},
                {field: 'khmc', align: 'center', title: '客户名称', rowspan: 2, width: 200},
                {field: 'hy', align: 'center', title: '行业', rowspan: 2, width: 200},
                {field: 'sheng', align: 'center', title: '省份', rowspan: 2, width: 200},
                {field: 'shi', align: 'center', title: '城市', rowspan: 2, width: 200},
                {field: 'htlx', align: 'center', title: '项目类型', rowspan: 2, width: 200},
                {field: 'sfysfk',align: 'center',title: '	是否有首付款',width: 200},
                {field: 'jlf', align: 'center', title: '监理合同额', rowspan: 2, width: 200},
                {field: 'zxf', align: 'center', title: '咨询合同额', rowspan: 2, width: 200},
                {field: 'jcf', align: 'center', title: '检测合同额', rowspan: 2, width: 200},
                {field: 'xmzd', align: 'center', title: '监理项目经理', rowspan: 2, width: 200},
                {field: 'zxxmzj', align: 'center', title: '咨询项目经理', rowspan: 2, width: 200},
                {field: 'jcxmjl', align: 'center', title: '检测项目经理', rowspan: 2, width: 200},
                {field: 'sqrq', align: 'center', title: '合同申请日期', rowspan: 2, width: 200},
                {field: 'gdrq', align: 'center', title: '合同归档日期', rowspan: 2, width: 200},
                {field: 'kpje', align: 'center', title: '开票总额', rowspan: 2, width: 200},
                {field: 'yhkje',align: 'center', title: '回款总额', rowspan: 2, width: 200},
                {field: 'jlmoney',align: 'center',title: '监理回款额',rowspan: 2, width: 200},
                {field: 'zxmoney',align: 'center',title: '咨询回款额',rowspan: 2, width: 200},
                {field: 'jcmoney',align: 'center',title: '检测回款额',rowspan: 2, width: 200}
            ]],
            done: function (res, currentCount) {
                //***重点***：table渲染完成后渲染element进度条
                element.render();
                $(".layui-table-page select").css("width", "80px");

            }
        });
        //监听工具条
        table.on('tool(tableList)', function (obj) {
            var data = obj.data;
            var that = $(this);
            if (obj.event === 'resetPassword') {
                parent.layer.confirm('确定重置密码？', function (index) {
                    var userId = data.userId;
                    layerAjax("resetPassword", {id: userId}, "", function (d) {
                        if (d.flag) {
                            parent.layer.close(index);
                            layer.msg("操作成功", {icon: 1});
                            tableIns.reload();
                        } else {
                            layer.msg("操作失败", {icon: 2});
                        }
                    })
                });
            }
        });
    });
    function provinceChange(object) {
        var code = $(object).find('option:selected').val();
        if (code == "") {
            return;
        }
        layerAjaxGet('/sys/register/getOrganize', {"code": code}, '', function (d) {
            if (d.flag == true) {
                $("#shi").empty().append("<option value=''>选择市</option>");
                for (var i = 0; i < d.data.length; i++) {
                    $("#shi").append("<option value='" + d.data[i].code + "'>" + d.data[i].name + "</option>");
                }
            } else {
                layer.msg(d.msg, {icon: 2});
            }
        });


    };

    //导出excel
    function exportTable(){
        var htmc = $('#htmc').val();
        var htbh = $('#htbh').val();
        var htlx = $('#htlx').val();
        var startDate = $('#startDate').val();
        var endDate = $('#endDate').val();
        var sfysfk = $('#sfysfk').val();
        var htmin = $('#htmin').val();
        var htmax = $('#htmax').val();
        var xmmin = $('#xmmin').val();
        var xmmax = $('#xmmax').val();
        var gqmin = $('#gqmin').val();
        var gqmax = $('#gqmax').val();
        var hy = $('#hy').val();
        var sqr = $('#sqr').val();
        var xmmc = $('#xmmc').val();
        var ssfb = $('#ssfb').val();
        var xsry = $('#xsry').val();
        var sheng = $('#sheng').val();
        var shi = $('#shi').val();
        var khmc = $('#khmc').val();
        var url= '/search/buProjectInfo/exportTableOaData?htmc='+htmc+'&htbh='+htbh+'&htlx='+htlx+'&hy='+hy+'&xmmc='+xmmc+'&ssfb='+ssfb+'&xsry='+xsry+'&sheng='+sheng+'&shi='+shi+'&khmc='+khmc;
        location.href = url;
    }



    //预览excel
    function viewTable(){
        var jsondata = queryData();
        layerAjax('/search/buProjectInfo/viewTableOaData', jsondata, '', function (d) {
            if(d.flag){
                if(d.data){
                    var w = ($(window).width()*0.8);
                    var h = ($(window).height()*0.8);
                    POBrowser.openWindowModeless('/sys/office/openwordTemp?ft=1&fid=' + d.data, 'width=1200px;height=800px;', '{}')
                }
            }else {
                layer.msg(d.msg, {icon: 2});
            }
            console.log(d);
        });
    }
    $(function () {
        //回车事件
        $(document).keydown(function(e){
            // 兼容FF和IE和Opera
            var theEvent = e || window.event;
            var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
            if (code == 13) {
                query();
            }
            return true;
        });
    })

    //重置
    function resetQuery(){
        $("#htmc").val('');$("#htbh").val('');$("#htlx").val('');
        $("#startDate").val('');$("#endDate").val('');$("#widinput").val('');
        $("#htmin").val('');$("#htmax").val('');$("#xmmin").val('');
        $("#xmmax").val('');$("#gqmin").val('');$("#gqmax").val('');
        $("#hy").val('');$("#sqr").val('');$("#xmmc").val('');
        $("#ssfb").val('');$("#xsry").val('');
        $("#khmc").val('');$("#sheng").val(''); $("#shi").val('');
        var jsondata = {
            htmc: "",
            htbh: "",
            htlx: "",
            startDate: "",
            endDate: "",
            sfysfk: "",
            htmin: "",
            htmax: "",
            xmmin: "",
            xmmax: "",
            gqmin: "",
            gqmax: "",
            hy: "",
            sqr: "",
            xmmc: "",
            ssfb: "",
            xsry: "",
            khmc: "",
            sheng: "",
            shi: ""
        }
        table.reload('tableList', {where: jsondata});
    }
</script>
</body>

</html>
